home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / GRAPHICS.SWG / 0148_Azimuth line.pas < prev    next >
Pascal/Delphi Source File  |  1995-03-03  |  793b  |  27 lines

  1.  
  2.   {
  3.     This procedure will draw a line from an origin point for a
  4.     specified length at a specified angle using the current linestyle.
  5.     Must be in graphics mode.
  6.   }
  7.  
  8.  
  9. Procedure Azimuth(OrigX,OrigY,Length:integer;Angle:real);
  10.  
  11.                  { OrigX and OrigY - starting point coordinates }
  12.                  { Length          - length of the line         }
  13.                  { Angle           - self explainatory          }
  14.  
  15. var A,B:real;
  16.  
  17. begin
  18.   Angle:=(Angle*pi)/180.0;    { convert angle in degrees to radians }
  19.  
  20.   moveto(OrigX,OrigY);        { move to the starting point          }
  21.  
  22.   A:=Length*sin(Angle);       { get there from here                 }
  23.   B:=Length*cos(Angle);
  24.  
  25.   linerel(round(B),round(A)); { draw line to calculated endpoint    }
  26. end;
  27.